#pragma once


// WriteEeprom dialog

class WriteEeprom : public CDialog
{
	DECLARE_DYNAMIC(WriteEeprom)

public:
	WriteEeprom(CWnd* pParent = NULL);   // standard constructor
	virtual ~WriteEeprom();

// Dialog Data
	enum { IDD = IDD_WRITEDIALOG };

	bool  b_write;
	bool  b_read;

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
	CString data;
	afx_msg void OnBnClickedWrite();
	afx_msg void OnBnClickedRead();
};

/*
ULONG StringHexToByteArray(CString Str, PBYTE pData)
{
	int Len;
    BYTE result = 0;
    ULONG RET = 0;
    CString temp1, temp2;
    CHAR t;

    Str.MakeUpper();
    Str.TrimLeft();
    Str.TrimRight();
    Len = Str.GetLength();

    int lastPos = 0, Pos = Str.Find(' ');

    while(Pos != -1)
    {
        temp1 = Str.Mid(lastPos, Pos - lastPos);
        if(temp1 == " ")
        {
            lastPos ++;
            Pos = Str.Find(' ', lastPos+1);
            continue;
        }

        result = 0;
        for(int i = 0; i < temp1.GetLength(); i++)
        {
            temp2 = temp1.Mid(i,1);
            if (temp2.FindOneOf("0123456789") != -1)
            {
                t = temp2.GetAt(0);
                t = t - '0';
                result = result * 16 + t;
            }
            if (temp2.FindOneOf("ABCDEF") != -1)
            {
                t = temp2.GetAt(0);
                t = t - 'A' + 10;
                result = result * 16 + t;
            }
        }
        *pData = result;
        pData++;
        RET++;
        lastPos = Pos;
        Pos = Str.Find(' ', lastPos+1);
    }

    if (Str.GetLength() > 0 && Len != lastPos)
    {
        temp1 = Str.Mid(lastPos, Len - lastPos);
        result = 0;
        for(int i = 0; i < temp1.GetLength(); i++)
        {
            temp2 = temp1.Mid(i,1);
            if (temp2.FindOneOf("0123456789") != -1)
            {
                t = temp2.GetAt(0);
                t = t - '0';
                result = result * 16 + t;
            }
            if (temp2.FindOneOf("ABCDEF") != -1)
            {
                t = temp2.GetAt(0);
                t = t - 'A' + 10;
                result = result * 16 + t;
            }
        }
        *pData = result;
        pData++;
        RET++;
    }

    return RET;
}*/